package no.group.gowther.service.dto.param;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import no.group.gowther.enums.FileType;
import no.group.gowther.util.JsonUtils;

public class FileFilingDetailQueryDTO extends FilingDetailQueryDTO {
    private String dirPath;
    private FileType fileType;

    public static boolean isMine(JsonNode param) {
        return param.get("dirPath") != null;
    }

    public static FileFilingDetailQueryDTO getInstance(JsonNode param) {
        try {
            return JsonUtils.toPOJO(param.toString(), FileFilingDetailQueryDTO.class);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return new FileFilingDetailQueryDTO();
    }

    public String getDirPath() {
        return dirPath;
    }

    public void setDirPath(String dirPath) {
        this.dirPath = dirPath;
    }

    public FileType getFileType() {
        return fileType;
    }

    public void setFileType(FileType fileType) {
        this.fileType = fileType;
    }
}
